package lee.vioson.ebook.viewmodels

import kotlinx.coroutines.flow.StateFlow
import lee.vioson.composecommon.base.mvi.BaseViewModel
import lee.vioson.composecommon.base.mvi.Reducer
import lee.vioson.composecommon.base.mvi.UiEvent
import lee.vioson.composecommon.base.mvi.UiState
import lee.vioson.ebook.R
import lee.vioson.ebook.models.TabData

/**
 *Author:viosonlee
 *Date:2023/6/3
 *DESCRIPTION:
 */
class MainViewModel :
    BaseViewModel<MainViewModel.State, MainViewModel.Event>() {

    val tabs = listOf(
        TabData(R.mipmap.tab_home, R.string.tab_home),
        TabData(R.mipmap.tab_favorites, R.string.tab_favorites),
        TabData(R.mipmap.tab_recently, R.string.tab_recently),
        TabData(R.mipmap.tab_my, R.string.tab_my),
    )

    private val reducer = SubReducer(State())

    override val state: StateFlow<State>
        get() = reducer.state

    override fun sendEvent(event: Event) {
        reducer.sendEvent(event)
    }

    private class SubReducer(initialState: State) :
        Reducer<State, Event>(initialState) {
        override fun reduce(oldState: State, event: Event) {

        }
    }


    sealed class Event : UiEvent {

    }

    class State : UiState {

    }
}

